package com.ohc.test;

public class Lab6 {
    public Integer length;

    public void digui(char[] s, int i) {
        // c语言写法，为\0结尾
        if (s[i] == '\0') {
            this.length = i;
            return;
        }
        i++;
        digui(s, i);
    }

    public static void main(String[] args) {
        char[] c = new char[]{'a', 'b', 'c', '\0'};
        Lab6 lab6 = new Lab6();
        int i = 0;
        lab6.digui(c, i);
        System.out.println("lab6.length = " + lab6.length);
//        char[] c = new char[]{'a', 'b', 'c', '\0'};
//        int slen = Slen(c);
//        System.out.println("slen = " + slen);
    }

    public static int Slen(char[] s) {
//         c语言写法
        int i = 0;
        while (s[i] != '\0') {
            i++;
        }
        return i;
    }
}
